package com.shujia.ik;

import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.IOException;
import java.io.StringReader;

public class WordIk {
    public static void main(String[] args) throws IOException {
        IKSegmenter ikSegmenter = new IKSegmenter(new StringReader("书中记录了少年巫师哈利波特和他最好的朋友罗恩韦斯莱和赫米恩格兰杰的冒险经历，他们都是霍格沃茨魔法学校的学生。"), true);
        Lexeme lexeme = null;
        while ((lexeme = ikSegmenter.next())!=null){
            System.out.println(lexeme.getLexemeText());
        }
    }
}
